<?php

/**
 * This is the model class for table "building_service_equipment".
 *
 * The followings are the available columns in table 'building_service_equipment':
 * @property integer $id
 * @property integer $boiler_provider
 * @property integer $no_of_unit_provided
 * @property string $bp_fuel
 * @property integer $bp_capacity
 * @property string $bp_container
 * @property string $bp_location
 * @property integer $lpg_installation_covered_with_permit
 * @property integer $fuel_with_storage_permit
 * @property integer $generator_set_provided
 * @property string $gsp_type
 * @property string $gsp_fuel
 * @property integer $gsp_capacity
 * @property string $gsp_location
 * @property integer $dike_or_bundwall_provided
 * @property string $gsp_container
 * @property string $gsp_dispensing_system
 * @property integer $output_capacity
 * @property string $gsp_mechanical_permit
 * @property string $gspmp_date_issued
 * @property integer $gsp_fuel_with_storage_permit
 * @property integer $gsp_automatic_transfer_switch_provided
 * @property integer $gsp_time_interval
 * @property string $other
 * @property integer $refuse_handling_facility_provided
 * @property integer $enclosure_provided
 * @property integer $fire_resistive
 * @property integer $fire_protection_provided
 * @property string $rhf_type
 * @property string $frequency_of_collection
 * @property string $how_collected
 * @property integer $any_electrical_hazard
 * @property string $aeh_location
 * @property integer $any_mechanical_hazard
 * @property string $amh_location
 * @property integer $no_of_elevator_provided
 * @property integer $fireman_elevator_provided
 * @property integer $fireman_key_or_switch_provided
 * @property string $other_bulding_service_system
 * @property integer $inspection_id
 *
 * The followings are the available model relations:
 * @property Inspection $inspection
 */
class BuildingServiceEquipment extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return BuildingServiceEquipment the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

const a = "Diesel";
const b ="Kerosene";
const c ="Coal";
const d ="Bunker";
const e ="LPG";
public function getBp_fuel(){
return array(
self::a=>"Diesel",
self::b=>"Kerosene",
self::c=>"Coal",
self::d=>"Bunker",
self::e	=>"LPG"
);


}
const f = "Aboveground";
const g ="Underground";
public function getBp_container(){
return array(
self::f=>"Aboveground",
self::g=>"Underground"
);


}

const h = "Manual";
const i ="Automatic";
public function getGsp_type(){
return array(
self::h=>"Manual",
self::i=>"Automatic"
);


}

const j = "Diesel";
const k ="Gasoline";
public function getGsp_fuel(){
return array(
self::j=>"Diesel",
self::k=>"Gasoline"
);


}

const l = "Aboveground";
const m ="Underground";
public function getGsp_container(){
return array(
self::l=>"Aboveground",
self::m=>"Underground"
);


}

const n = "Pump";
const o ="Gravity";
public function Gsp_dispensing_system(){
return array(
self::n=>"Pump",
self::o=>"Gravity"
);


}






	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'building_service_equipment';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('inspection_id', 'required'),
			array('boiler_provider, no_of_unit_provided, bp_capacity, lpg_installation_covered_with_permit, fuel_with_storage_permit, generator_set_provided, gsp_capacity, dike_or_bundwall_provided, output_capacity, gsp_fuel_with_storage_permit, gsp_automatic_transfer_switch_provided, gsp_time_interval, refuse_handling_facility_provided, enclosure_provided, fire_resistive, fire_protection_provided, any_electrical_hazard, any_mechanical_hazard, no_of_elevator_provided, fireman_elevator_provided, fireman_key_or_switch_provided, inspection_id', 'numerical', 'integerOnly'=>true),
			array('bp_fuel, gsp_fuel', 'length', 'max'=>8),
			array('bp_container, gsp_container', 'length', 'max'=>11),
			array('gsp_type', 'length', 'max'=>9),
			array('gsp_dispensing_system', 'length', 'max'=>7),
			array('bp_location, gsp_location, gsp_mechanical_permit, gspmp_date_issued, other, rhf_type, frequency_of_collection, how_collected, aeh_location, amh_location, other_bulding_service_system', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, boiler_provider, no_of_unit_provided, bp_fuel, bp_capacity, bp_container, bp_location, lpg_installation_covered_with_permit, fuel_with_storage_permit, generator_set_provided, gsp_type, gsp_fuel, gsp_capacity, gsp_location, dike_or_bundwall_provided, gsp_container, gsp_dispensing_system, output_capacity, gsp_mechanical_permit, gspmp_date_issued, gsp_fuel_with_storage_permit, gsp_automatic_transfer_switch_provided, gsp_time_interval, other, refuse_handling_facility_provided, enclosure_provided, fire_resistive, fire_protection_provided, rhf_type, frequency_of_collection, how_collected, any_electrical_hazard, aeh_location, any_mechanical_hazard, amh_location, no_of_elevator_provided, fireman_elevator_provided, fireman_key_or_switch_provided, other_bulding_service_system, inspection_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'inspection' => array(self::BELONGS_TO, 'Inspection', 'inspection_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'boiler_provider' => 'Boiler Provider',
			'no_of_unit_provided' => 'No Of Unit Provided',
			'bp_fuel' => 'Bp Fuel',
			'bp_capacity' => 'Bp Capacity',
			'bp_container' => 'Bp Container',
			'bp_location' => 'Bp Location',
			'lpg_installation_covered_with_permit' => 'Lpg Installation Covered With Permit',
			'fuel_with_storage_permit' => 'Fuel With Storage Permit',
			'generator_set_provided' => 'Generator Set Provided',
			'gsp_type' => 'Gsp Type',
			'gsp_fuel' => 'Gsp Fuel',
			'gsp_capacity' => 'Gsp Capacity',
			'gsp_location' => 'Gsp Location',
			'dike_or_bundwall_provided' => 'Dike Or Bundwall Provided',
			'gsp_container' => 'Gsp Container',
			'gsp_dispensing_system' => 'Gsp Dispensing System',
			'output_capacity' => 'Output Capacity',
			'gsp_mechanical_permit' => 'Gsp Mechanical Permit',
			'gspmp_date_issued' => 'Gspmp Date Issued',
			'gsp_fuel_with_storage_permit' => 'Gsp Fuel With Storage Permit',
			'gsp_automatic_transfer_switch_provided' => 'Gsp Automatic Transfer Switch Provided',
			'gsp_time_interval' => 'Gsp Time Interval',
			'other' => 'Other',
			'refuse_handling_facility_provided' => 'Refuse Handling Facility Provided',
			'enclosure_provided' => 'Enclosure Provided',
			'fire_resistive' => 'Fire Resistive',
			'fire_protection_provided' => 'Fire Protection Provided',
			'rhf_type' => 'Rhf Type',
			'frequency_of_collection' => 'Frequency Of Collection',
			'how_collected' => 'How Collected',
			'any_electrical_hazard' => 'Any Electrical Hazard',
			'aeh_location' => 'Aeh Location',
			'any_mechanical_hazard' => 'Any Mechanical Hazard',
			'amh_location' => 'Amh Location',
			'no_of_elevator_provided' => 'No Of Elevator Provided',
			'fireman_elevator_provided' => 'Fireman Elevator Provided',
			'fireman_key_or_switch_provided' => 'Fireman Key Or Switch Provided',
			'other_bulding_service_system' => 'Other Bulding Service System',
			'inspection_id' => 'Inspection',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('boiler_provider',$this->boiler_provider);
		$criteria->compare('no_of_unit_provided',$this->no_of_unit_provided);
		$criteria->compare('bp_fuel',$this->bp_fuel,true);
		$criteria->compare('bp_capacity',$this->bp_capacity);
		$criteria->compare('bp_container',$this->bp_container,true);
		$criteria->compare('bp_location',$this->bp_location,true);
		$criteria->compare('lpg_installation_covered_with_permit',$this->lpg_installation_covered_with_permit);
		$criteria->compare('fuel_with_storage_permit',$this->fuel_with_storage_permit);
		$criteria->compare('generator_set_provided',$this->generator_set_provided);
		$criteria->compare('gsp_type',$this->gsp_type,true);
		$criteria->compare('gsp_fuel',$this->gsp_fuel,true);
		$criteria->compare('gsp_capacity',$this->gsp_capacity);
		$criteria->compare('gsp_location',$this->gsp_location,true);
		$criteria->compare('dike_or_bundwall_provided',$this->dike_or_bundwall_provided);
		$criteria->compare('gsp_container',$this->gsp_container,true);
		$criteria->compare('gsp_dispensing_system',$this->gsp_dispensing_system,true);
		$criteria->compare('output_capacity',$this->output_capacity);
		$criteria->compare('gsp_mechanical_permit',$this->gsp_mechanical_permit,true);
		$criteria->compare('gspmp_date_issued',$this->gspmp_date_issued,true);
		$criteria->compare('gsp_fuel_with_storage_permit',$this->gsp_fuel_with_storage_permit);
		$criteria->compare('gsp_automatic_transfer_switch_provided',$this->gsp_automatic_transfer_switch_provided);
		$criteria->compare('gsp_time_interval',$this->gsp_time_interval);
		$criteria->compare('other',$this->other,true);
		$criteria->compare('refuse_handling_facility_provided',$this->refuse_handling_facility_provided);
		$criteria->compare('enclosure_provided',$this->enclosure_provided);
		$criteria->compare('fire_resistive',$this->fire_resistive);
		$criteria->compare('fire_protection_provided',$this->fire_protection_provided);
		$criteria->compare('rhf_type',$this->rhf_type,true);
		$criteria->compare('frequency_of_collection',$this->frequency_of_collection,true);
		$criteria->compare('how_collected',$this->how_collected,true);
		$criteria->compare('any_electrical_hazard',$this->any_electrical_hazard);
		$criteria->compare('aeh_location',$this->aeh_location,true);
		$criteria->compare('any_mechanical_hazard',$this->any_mechanical_hazard);
		$criteria->compare('amh_location',$this->amh_location,true);
		$criteria->compare('no_of_elevator_provided',$this->no_of_elevator_provided);
		$criteria->compare('fireman_elevator_provided',$this->fireman_elevator_provided);
		$criteria->compare('fireman_key_or_switch_provided',$this->fireman_key_or_switch_provided);
		$criteria->compare('other_bulding_service_system',$this->other_bulding_service_system,true);
		$criteria->compare('inspection_id',$this->inspection_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}